<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<include file="./Home/Tpl/Admin/Common/cssjs.html" />
<link rel="stylesheet" type="text/css" href="{$Config.siteurl}statics/js/ueditor/themes/default/ueditor.css"/>
<script type="text/javascript">
$(document).ready(function() {
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$("#name").formValidator({onshow:"请输入名称",onfocus:"请输入名称",oncorrect:"输入正确"}).inputValidator({min:1,max:20,onerror:"请输入名称"});
	$("#type").formValidator({onshow:"请选择调用类型",onfocus:"请选择调用类型",oncorrect:"选择正确"}).inputValidator({min:1,max:20,onerror:"请选择调用类型"});
})
</script>
</head>
<body>
<div class="subnav">
  <div class="content-menu ib-a blue line-x"> <a href="{:U("Datacall/Datacall/index")}"><em>数据调用</em></a>
  <span>|</span><a href="{:U("Datacall/Datacall/add")}"  class="on"><em>添加数据调用</em></a></div>
</div>
<div class="pad_10">
  <div class="common-form">
    <form name="myform" action="{:U("Datacall/Datacall/add")}" method="post" id="myform">
      <table width="100%" class="table_form contentWrap">
        <tbody>
        <tr>
          <td  width="80">名称：</td>
          <td><input type="text" name="name" value="" class="input-text" id="name" size="30" style=" width:300px;"></td>
        </tr>
        <tr>
          <td  width="80">输出类型：</td>
          <td><?php echo Form::select($type, '', 'name="type" id="type"','选择调用类型');?></td>
        </tr>
        <tr>
          <td  width="80">缓存时间：</td>
          <td><input type="text" name="cachetime" value="3600" class="input-text" id="name" size="30"> 秒</td>
        </tr>
        <tr>
          <td  width="80">模板：</td>
          <td><textarea name="temptext" style=" width:456px; height:180px;"></textarea><br />提示：模板只对输出类型为javascript有效</td>
        </tr>
        <tr>
          <td  width="80">参数配置：</td>
          <td>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td  width="80">调用类型：</td>
              <td><?php echo Form::select(array('category'=>"栏目调用",'model'=>"模型调用",'sql'=>"SQL"), '1', 'name="setting[type]" id="settingtype" onChange="typefun()"');?></td>
            </tr>
            <tr>
              <td  width="80">信息数：</td>
              <td><input type="text" name="setting[limit]" value="10" class="input-text" id="setting[limit]" size="30"> 条</td>
            </tr>
            <tr>
              <td  width="80">排序：</td>
              <td><input type="text" name="setting[order]" value="id DESC" class="input-text" id="setting[order]" size="30"> </td>
            </tr>
            <tr>
              <td  width="80">开启分页：</td>
              <td><select name="setting[page]" id="setting[page]"><option value="0" selected>关闭</option><option value="1">开启</option></select> 提示：开启以后调用地址增加URL参数 <?=C("VAR_PAGE")?>=分页数</td>
            </tr>
            <tr>
              <td  width="80">返回字段：</td>
              <td><input type="text" name="setting[field]" value="{$setting['field']}" class="input-text" id="setting[field]"  style=" width:500px;"> 例如：id,catid</td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="setting_category" class="setting">
             <tr>
              <td  width="80">栏目选择：</td>
              <td>
              <select name="setting[category][]" id="setting[category]" size="10" multiple>
                    {$category}
              </select>
              注意：只支持模型相同的栏目数据调用！
              </td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="setting_model" style="display:none;"  class="setting">
             <tr>
              <td  width="80">模型选择：</td>
              <td><?php echo Form::select($Model, '', 'name="setting[modeid]" id="setting[modeid]"');?></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="setting_sql" style="display:none;"  class="setting">
             <tr>
              <td  width="80">SQL语句：</td>
              <td><input type="text" name="setting[sql]" value="" class="input-text" id="setting[sql]" size="30" style=" width:500px;">提示：不写limit、order等，只支持SELECT。</td>
            </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td  width="80">状态：</td>
          <td><?php echo Form::select(array("关闭","开启"), '1', 'name="status" id="status"');?></td>
        </tr>
      </tbody>
      </table>
      <div class="bk15"></div>
      <input name="dosubmit" type="submit" value="提交" class="button" id="dosubmit">
    </form>
  </div>
</div>
<script type="text/javascript">
function typefun(){
	$(".setting").hide();
	$("#setting_"+$('#settingtype').val()).show();
}
</script>
</body>
</html>